<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Nginx 技术指南</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .card-hover {
            transition: all 0.3s ease;
        }
        
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }
        
        .feature-icon {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        
        .code-block {
            background: #1e1e1e;
            color: #d4d4d4;
            border-radius: 8px;
            padding: 1.5rem;
            overflow-x: auto;
            font-family: 'Consolas', 'Monaco', monospace;
        }
        
        .section-divider {
            height: 2px;
            background: linear-gradient(to right, transparent, #667eea, transparent);
            margin: 3rem 0;
        }
        
        .drop-cap {
            float: left;
            font-size: 4rem;
            line-height: 1;
            font-weight: 700;
            margin-right: 0.5rem;
            color: #667eea;
            font-family: 'Noto Serif SC', serif;
        }
        
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6 text-center">
            <h1 class="text-5xl md:text-6xl font-bold mb-4 tracking-tight">
                <i class="fas fa-server mr-4"></i>Nginx 技术指南
            </h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90">高性能 Web 服务器与反向代理解决方案</p>
            <div class="flex justify-center space-x-8 text-sm">
                <div><i class="fas fa-rocket mr-2"></i>高性能</div>
                <div><i class="fas fa-shield-alt mr-2"></i>高可靠</div>
                <div><i class="fas fa-cogs mr-2"></i>易扩展</div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto px-6 py-12 max-w-6xl">
        
        <!-- Overview Section -->
        <section class="bg-white rounded-2xl shadow-xl p-8 mb-12">
            <h2 class="text-3xl font-bold mb-6 text-gray-800">
                <i class="fas fa-info-circle mr-3 feature-icon"></i>Nginx 概述
            </h2>
            <p class="text-lg leading-relaxed text-gray-700 mb-6">
                <span class="drop-cap">N</span>ginx 是一款高性能的开源 Web 服务器，也可以作为反向代理服务器、负载均衡器和 HTTP 缓存服务器使用。它是由俄罗斯的程序员 Igor Sysoev 编写的，首次发布于 2004 年。Nginx 因其高性能、稳定性和丰富的功能而受到广泛欢迎，被用于许多大型的网站和 Web 应用程序中。
            </p>
        </section>

        <!-- Features Grid -->
        <section class="mb-12">
            <h2 class="text-3xl font-bold mb-8 text-center text-gray-800">核心特性</h2>
            <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
                <div class="bg-white rounded-xl p-6 card-hover">
                    <div class="text-4xl mb-4 text-center">
                        <i class="fas fa-tachometer-alt feature-icon"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">高性能</h3>
                    <p class="text-gray-600">采用事件驱动的异步非阻塞架构，能够处理大量并发连接而不会消耗过多的系统资源。</p>
                </div>
                
                <div class="bg-white rounded-xl p-6 card-hover">
                    <div class="text-4xl mb-4 text-center">
                        <i class="fas fa-memory feature-icon"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">低内存消耗</h3>
                    <p class="text-gray-600">即使在高负载情况下也能保持较低的内存占用，资源利用效率极高。</p>
                </div>
                
                <div class="bg-white rounded-xl p-6 card-hover">
                    <div class="text-4xl mb-4 text-center">
                        <i class="fas fa-sync-alt feature-icon"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">热部署</h3>
                    <p class="text-gray-600">支持在不中断服务的情况下动态加载和卸载模块，方便运维管理。</p>
                </div>
                
                <div class="bg-white rounded-xl p-6 card-hover">
                    <div class="text-4xl mb-4 text-center">
                        <i class="fas fa-puzzle-piece feature-icon"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">模块化设计</h3>
                    <p class="text-gray-600">通过加载不同的模块来扩展功能，如 HTTP 代理、负载均衡、SSL 支持等。</p>
                </div>
                
                <div class="bg-white rounded-xl p-6 card-hover">
                    <div class="text-4xl mb-4 text-center">
                        <i class="fas fa-shield-alt feature-icon"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">高可靠性</h3>
                    <p class="text-gray-600">具有出色的稳定性，能够长时间运行而不会出现内存泄漏或崩溃现象。</p>
                </div>
                
                <div class="bg-white rounded-xl p-6 card-hover">
                    <div class="text-4xl mb-4 text-center">
                        <i class="fas fa-sliders-h feature-icon"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">灵活性</h3>
                    <p class="text-gray-600">支持灵活的配置选项，可根据具体需求进行定制，适用于各种规模的应用。</p>
                </div>
            </div>
        </section>

        <div class="section-divider"></div>

        <!-- Architecture Visualization -->
        <section class="bg-white rounded-2xl shadow-xl p-8 mb-12">
            <h2 class="text-3xl font-bold mb-6 text-gray-800">
                <i class="fas fa-sitemap mr-3 feature-icon"></i>Nginx 架构概览
            </h2>
            <div class="mermaid">
                graph TB
                    A[客户端请求] --> B[Nginx Master进程]
                    B --> C[Worker进程1]
                    B --> D[Worker进程2]
                    B --> E[Worker进程N]
                    C --> F[静态资源]
                    C --> G[反向代理]
                    D --> H[负载均衡]
                    E --> I[缓存服务]
                    
                    style A fill:#f9f,stroke:#333,stroke-width:2px
                    style B fill:#667eea,stroke:#333,stroke-width:2px,color:#fff
                    style C fill:#9f7aea,stroke:#333,stroke-width:2px,color:#fff
                    style D fill:#9f7aea,stroke:#333,stroke-width:2px,color:#fff
                    style E fill:#9f7aea,stroke:#333,stroke-width:2px,color:#fff
            </div>
        </section>

        <!-- Use Cases -->
        <section class="mb-12">
            <h2 class="text-3xl font-bold mb-8 text-gray-800">
                <i class="fas fa-tools mr-3 feature-icon"></i>主要用途
            </h2>
            <div class="space-y-6">
                <div class="bg-gradient-to-r from-purple-50 to-pink-50 rounded-xl p-6 border-l-4 border-purple-500">
                    <h3 class="text-xl font-semibold mb-2 flex items-center">
                        <i class="fas fa-globe mr-3 text-purple-500"></i>Web 服务器
                    </h3>
                    <p class="text-gray-700">作为 Web 服务器，能够快速地处理静态文件和动态请求，并且支持高并发的访问。</p>
                </div>
                
                <div class="bg-gradient-to-r from-blue-50 to-cyan-50 rounded-xl p-6 border-l-4 border-blue-500">
                    <h3 class="text-xl font-semibold mb-2 flex items-center">
                        <i class="fas fa-exchange-alt mr-3 text-blue-500"></i>反向代理
                    </h3>
                    <p class="text-gray-700">将客户端的请求转发到多个后端服务器上，实现负载均衡和高可用性。</p>
                </div>
                
                <div class="bg-gradient-to-r from-green-50 to-teal-50 rounded-xl p-6 border-l-4 border-green-500">
                    <h3 class="text-xl font-semibold mb-2 flex items-center">
                        <i class="fas fa-balance-scale mr-3 text-green-500"></i>负载均衡
                    </h3>
                    <p class="text-gray-700">支持多种负载均衡算法，可以均衡地分配请求到不同的后端服务器。</p>
                </div>
                
                <div class="bg-gradient-to-r from-yellow-50 to-orange-50 rounded-xl p-6 border-l-4 border-yellow-500">
                    <h3 class="text-xl font-semibold mb-2 flex items-center">
                        <i class="fas fa-database mr-3 text-yellow-500"></i>HTTP 缓存服务器
                    </h3>
                    <p class="text-gray-700">缓存静态文件和动态内容，减轻后端服务器的压力，提高网站的响应速度。</p>
                </div>
            </div>
        </section>

        <div class="section-divider"></div>

        <!-- Proxy Concepts -->
        <section class="bg-white rounded-2xl shadow-xl p-8 mb-12">
            <h2 class="text-3xl font-bold mb-8 text-gray-800">
                <i class="fas fa-network-wired mr-3 feature-icon"></i>代理概念详解
            </h2>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-gradient-to-br from-purple-100 to-pink-100 rounded-xl p-6">
                    <h3 class="text-2xl font-semibold mb-4 text-purple-800">
                        <i class="fas fa-arrow-right mr-2"></i>正向代理
                    </h3>
                    <p class="text-gray-700 mb-4">正向代理是给客户端做代理，客户端清楚要访问的目标服务器。</p>
                    <ul class="space-y-2 text-gray-600">
                        <li><i class="fas fa-check-circle mr-2 text-purple-500"></i>访问原来无法访问的资源</li>
                        <li><i class="fas fa-check-circle mr-2 text-purple-500"></i>用作缓存，加速访问速度</li>
                        <li><i class="fas fa-check-circle mr-2 text-purple-500"></i>对客户端访问授权，上网进行认证</li>
                        <li><i class="fas fa-check-circle mr-2 text-purple-500"></i>记录用户访问记录，对外隐藏用户信息</li>
                    </ul>
                </div>
                
                <div class="bg-gradient-to-br from-blue-100 to-cyan-100 rounded-xl p-6">
                    <h3 class="text-2xl font-semibold mb-4 text-blue-800">
                        <i class="fas fa-arrow-left mr-2"></i>反向代理
                    </h3>
                    <p class="text-gray-700 mb-4">反向代理给服务端做代理，客户端不知道要访问哪台服务器。</p>
                    <ul class="space-y-2 text-gray-600